#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021-6-26 16:07
# @Author  : ling
# @File    : base.py
# @Software: PyCharm

from appium import webdriver
from faker import Faker


class Base():

    def setup(self):
        caps = {}
        caps["platformName"] = "android"
        caps["deviceName"] = "127.0.0.1:62001"
        caps["appPackage"] = "com.tencent.wework"
        caps["appActivity"] = ".launch.LaunchSplashActivity"
        caps["noReset"] = "true"
        #caps["automationName"] = "UiAutomator2"
        caps["ensureWebviewsHavePages"] = True
        # 最重要的一行，完成了客户端与服务端的连接，创建driver
        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", caps)
        #隐士等待，全局设置
        self.driver.implicitly_wait(5)
    def teardown(self):
        self.driver.quit()
